package com.imaker.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.imaker.domain.ActionInfo;
import com.imaker.domain.RoleActionOperateInfo;
import com.imaker.service.ActionOperateService;
import com.imaker.service.ActionService;
import com.imaker.service.RoleActionOperateService;

@Controller
@Scope("prototype")
public class RoleActionOperateAction extends BaseAction{

	@Autowired
	private RoleActionOperateService roleActionOperateService = null;
	@Autowired
	private ActionService actionService;
	@Autowired
	private ActionOperateService actionOperateService = null;
	private RoleActionOperateInfo roleActionOperateInfo;
	private List<RoleActionOperateInfo> roleActionOperateList;
	private List<ActionInfo> actionList;
	private String actionId;
	private String roleId;
	/**
	 * 初始化
	 * @return
	 */
	public String init(){
		
		return SUCCESS;
	}
	
	/**
	 * 树
	 * @return
	 */
	public String tree() throws Exception {
		actionList = actionService.findAll();
		getRequest().setAttribute("actionInfoList",actionList);
		return SUCCESS;
	}
	
	/**
	 *查询
	 */
	public String listChildren() throws Exception {
		page = actionOperateService.listByPage(page, actionId);
		try{
			roleActionOperateList = roleActionOperateService.findByRole(roleId);
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return SUCCESS;
	}
	
	
	public RoleActionOperateService getRoleActionOperateService() {
		return roleActionOperateService;
	}

	public void setRoleActionOperateService(
			RoleActionOperateService roleActionOperateService) {
		this.roleActionOperateService = roleActionOperateService;
	}

	public RoleActionOperateInfo getRoleActionOperateInfo() {
		return roleActionOperateInfo;
	}

	public void setRoleActionOperateInfo(RoleActionOperateInfo roleActionOperateInfo) {
		this.roleActionOperateInfo = roleActionOperateInfo;
	}

	public List<RoleActionOperateInfo> getRoleActionOperateList() {
		return roleActionOperateList;
	}

	public void setRoleActionOperateList(
			List<RoleActionOperateInfo> roleActionOperateList) {
		this.roleActionOperateList = roleActionOperateList;
	}

	public ActionService getActionService() {
		return actionService;
	}

	public void setActionService(ActionService actionService) {
		this.actionService = actionService;
	}

	public ActionOperateService getActionOperateService() {
		return actionOperateService;
	}

	public void setActionOperateService(ActionOperateService actionOperateService) {
		this.actionOperateService = actionOperateService;
	}

	public List<ActionInfo> getActionList() {
		return actionList;
	}

	public void setActionList(List<ActionInfo> actionList) {
		this.actionList = actionList;
	}

	public String getActionId() {
		return actionId;
	}

	public void setActionId(String actionId) {
		this.actionId = actionId;
	}

	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}
}
